package com.sec.etech.sys.msg;

import com.sec.etech.sys.msg.model.EtechEmailMessage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.openbpm.base.api.response.impl.ResultMsg;
import org.openbpm.base.rest.ControllerTools;
import org.openbpm.form.util.DateUtils;
import org.openbpm.sys.core.manager.MsgTemplateManager;
import org.openbpm.sys.core.model.MsgTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

@RestController
@RequestMapping({"/etech/mail"})
public class EtechMailController extends ControllerTools {

    @Resource
    private MsgTemplateManager msgTemplateManager;

    @Resource
    private EtechMailService mailService;

    @RequestMapping(value = {"/templateTestMail"})
  public ResultMsg<String> templateTestMail(@RequestBody MsgTemplate t) {
        EtechEmailMessage msg = new EtechEmailMessage();
        msg.setSubject(t.getSubject());
        msg.setHtmlContent(t.getHtml());
        mailService.sendMail(msg);
        return new ResultMsg<>("send mail");
    }


}
